package com.directv.z8training.ex3;

import java.util.ArrayList;
import java.util.List;

/**
 * @author HieuLT8
 *
 */
public class Bank {
	private List<Observer> observers = new ArrayList<Observer>();
	   private int state;

	   public int getState() {
	      return state;
	   }

	   public void setState(int state) {
	      this.state = state;
	      notifyAllObservers();
	   }

	   /**
	 * @param observer
	 */
	public void attach(Observer observer){
	      observers.add(observer);		
	   }

	   public void notifyAllObservers(){
	      for (Observer observer : observers) {
	         observer.update();
	      }
	   } 	
}
